<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>添加管理员账号</title>
    <link rel="stylesheet" href="../SignUpStyle.css">
    <link href="https://fonts.googleapis.com/css?familymPermanent+Marker" >
    <script type="text/javascript">
    function go(){
         window.history.go(-1);
        //history.go(-1);
    }

    function check(form){
        var ID = form.ID.value;
        if(ID.length==0){
        alert("请填写账号！");
        form.ID.focus();
        return false;
        }

        var passwd = form.passwd.value;
        if(passwd.length==0){
        alert("请填写密码！");
        form.passwd.focus();
        return false;
        }

        var repasswd = form.repasswd.value;
        if(repasswd.length==0){
        alert("请填写确认密码!");
        form.repasswd.focus();
        return false;
        }

        if(passwd != repasswd){
        alert("两次密码不一致！");
        form.repasswd.focus();
        return false;
        }
    }
    </script>
</head>
<?php
    session_start();
    include_once("../is_login.php");
    if(!is_login()){
        echo "<script>alert('请登录系统后访问!');window.location.href='http://localhost:8080/PHP-NEWS-RELEASE-SYSTEM/Application/User/Page/login.php'</script>";
    }
    if(!is_superadmin()){
        echo "<script>alert('权限不足!');window.location.href='http://localhost:8080/PHP-NEWS-RELEASE-SYSTEM/Application/User/Page/login.php'</script>";
    }

?>
<body>
<div class="sign-div">
    <form class="" action="../Action/add_admin_action.php" method="post" name="input" onSubmit="return check(this);">
        <h1>添加管理员账号</h1>
        <input class="sign-text" type="text" placeholder="账号" name="ID">
        <input class="sign-text" type="text" placeholder="用户名" name="username">
        <input class="sign-text" type="password" placeholder="密码" name="passwd">
        <input class="sign-text" type="password" placeholder="确认密码" name="repasswd">
        <input class="sign-text" type="email" placeholder="邮箱" name="email">
        <select class="beauty-select" name="sex" size="1">
            <option value="保密" selected>------------------------请选择性别---------------------</option>
            <option value="保密" >保密</option>
            <option value="男">男</option>
            <option value="女">女</option> 
        </select>
        <input class="sign-btn" type="submit" value="添加账户">
        <a href="" onclick="javascript:history.back(-1)">返回</a>
        <a href="http://localhost:8080/PHP-NEWS-RELEASE-SYSTEM/Application/User/Page/login.php">返回主页</a>
    </form>
</div>
</body>
</html>

